package com.account.manager.service.impl;

import java.sql.Timestamp;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.account.manager.dao.AccountDao;
import com.account.manager.service.AccountService;
import com.account.manager.vo.Account;

@Service
public class AccountServiceImpl implements AccountService{
	
	@Resource
	private AccountDao accountDao;
	
	@Override
	public List<Account> findUserList(Account account, Long startTime,
			Long endTime) {
		
		if(startTime==null || endTime == null){
			return accountDao.query(account, null, null);
		}else {
			return accountDao.query(account, new Timestamp(startTime), new Timestamp(endTime));
		}
	}

	@Override
	public void deleteAccount(String code) {
		accountDao.delete(code);
		
	}

	@Override
	public void insertAccount(Account account) {
		accountDao.insert(account);
		
	}

	@Override
	public void updateAccountInfo(String code, Account account) {
		accountDao.update(code, account);
		
	}

}
